import Vue from 'vue'
import Router from 'vue-router'
import Main from '@/components/assembly/maxassembly/main'
import Home from '@/components/assembly/home/home'
import Login from '@/components/assembly/login/login'
import LoginDefault from '@/components/assembly/login/login-default'
//import Lizi from '@/components/assembly/home/lizi'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: '首页',
  		redirect: '/main'
    },
    {
      path: '/main',
      name: '首页',
      component: Main,
      children:[
      	{
	      	path: '/',
	        name: '首页',
	        redirect: '/home/home'//进入main就默认将路由重定向到这个路径
	      },
	      {
	      	path: '/home/home',
	      	name: '首页',
	      	component: Home,
//	      	beforeEnter(to,from,next){
//			    	if(localStorage.hasOwnProperty('222')){
//			    		next()
//			    	}else{
//			    		alert("请先登录")
//			    		router.push({path: '/login'})
//			    	}
//			    }
	      },
//	      {
//	      	path: '/home/lizi',
//	      	name: '例子',
//	      	component: Lizi
//	      },
      ]
    },
    {
	  	path: '/login',
	  	name: '登录',
	  	component: Login,
	  	children:[
		  	{
		  		path: '/',
	        name: '登录',
	        redirect: '/login/login-default'
		  	},
		  	{
		  		path: '/login/login-default',
	      	name: '登录',
	      	component: LoginDefault
		  	}
	  	]
	  },
  ]
})
